xyloObj = VideoReader('/data/AAMs/Tracking/OriginalVideos/IntheWild/6937.flv');

nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;

% Preallocate movie structure.
mov(1:nFrames) = ...
    struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
           'colormap', []);

% Read one frame at a time.
% for k = 1:nFrames
%     mov(k).cdata = read(xyloObj, k);
%     if k < 10
%       imwrite(mov(k).cdata,['000' int2str(k) '.png'],'PNG');
%     elseif k < 100
%       imwrite(mov(k).cdata,['00' int2str(k) '.png'],'PNG');
%     elseif k < 1000
%       imwrite(mov(k).cdata,['0' int2str(k) '.png'],'PNG');
%     else
%       imwrite(mov(k).cdata,[int2str(k) '.png'],'PNG');
%     end
% end
% 
% % Size a figure based on the video's width and height.
% hf = figure;
% set(hf, 'position', [150 150 vidWidth vidHeight])
% 
% % Play back the movie once at the video's frame rate.
% movie(hf, mov, 1, xyloObj.FrameRate);
% 
